{% extends 'userbase.html' %}
{% block title %}商品订单{% endblock %}
{% block head_title %}商品订单{% endblock %}
{% block framework %}
<div class="cw1000">
	<div class="public_box pd10">
		<div class="list_title">
			<h2>商品订单</h2>
		</div>
		<div class="public_tag">
			<ul>
				<li><a {% if order_state == '' %}class="cur"{% endif %} href="?order_state=">全部订单</a></li>
				<li><a {% if order_state == 'wzf' %}class="cur"{% endif %} href="?order_state=wzf">待付款</a></li>
				<li><a {% if order_state == 'yzf' %}class="cur"{% endif %} href="?order_state=yzf">待收货</a></li>
                <li><a {% if order_state == 'ysh' %}class="cur"{% endif %} href="?order_state=ysh">待评价</a></li>
				<li><a {% if order_state == 'ywc' %}class="cur"{% endif %} href="?order_state=ywc">已完成</a></li>
				<div class="clear"></div>
			</ul>
		</div>
		<!-----------------商品订单---------------->
		<div class="order_list">
			<div class="column_title">
				<ul>
					<li style="width:35%;">订单信息</li>
					<li style="width:10%;">数量</li>
					<li style="width:10%;">单价</li>
					<li style="width:10%;">总价</li>
					<li style="width:20%;">订单状态</li>
					<li style="width:15%;">操作</li>
				</ul>
			</div>
			<div class="list_con">
				<ul>
                    {% for order in all_orders_list %}
                    <li>
						<div class="serial">订单编号：{{ order.order_num }}<a href="#"><i class="del"></i>删除</a></div>
						<div class="cont">
                            {% for goods in order.goods_list %}
							    <div class="con">
								<div class="info" style="width:35%;">
									<div class="pic"><a href="{% url 'shop:pro_detail' goods.good_id %}"><img width=53 height=53 src="{{ MEDIA_URL }}{{ goods.good_image }}" /></a></div>
									<div class="name">
										<a href="{% url 'shop:pro_detail' goods.good_id %}">{{ goods.good_name|truncatechars:"15" }}</a>
										<p>下单日期：{{ order.create_time|date:"Y-m-d" }}</p>
									</div>
									<div class="clear"></div>
								</div>
								<div class="number" style="width:10%;">x{{ goods.good_num }}</div>
								<div class="price" style="width:10%;">￥{{ goods.good_price }}</div>
                                {% if forloop.counter == 1 %}
                                    <div class="m_price" style="width:10%;"><div class="middle">￥{{ order.totalprice }}</div></div>
                                    {% if order.order_state == 'wzf' %}
                                    <div class="state" style="width:20%;">
									<div class="middle">
										<p>未付款</p>
										<a href="{% url 'shop:order_detail' order.order_num %}">订单详情</a>
									</div>
								</div>
								    <div class="operation" style="width:15%;">
									<div class="middle">
										<a class="buy" href="{% url 'pay:submit_order' %}?from=goods_order&order_num={{ order.order_num }}">去付款</a>
									</div>
								</div>
                                {% elif order.order_state == 'yzf' %}
                                    <div class="state" style="width:20%;">
									<div class="middle">
										<p>待收货</p>
										<a href="{% url 'shop:order_detail' order.order_num %}">订单详情</a>
									</div>
								</div>
								    <div class="operation" style="width:15%;">
									<div class="middle">
										<a class="buy" href="{% url 'operation:confirmgoods' %}?order_num={{ order.order_num }}">确认收货</a>
									</div>
								</div>
                                {% elif order.order_state == 'ysh' %}
                                         <div class="state" style="width:20%;">
									<div class="middle">
										<p>待评价</p>
										<a href="{% url 'shop:order_detail' order.order_num %}">订单详情</a>
									</div>
								</div>
								    <div class="operation" style="width:15%;">
									<div class="middle">
										<a class="buy" href="{% url 'operation:commentsgoods' %}?order_num={{ order.order_num }}">评价</a>
									</div>
								</div>
                                {% else %}
                                    <div class="state" style="width:20%;">
									<div class="middle">
										<p>已完成</p>
										<a href="{% url 'shop:order_detail' order.order_num %}">订单详情</a>
									</div>
								</div>
								    <div class="operation" style="width:15%;">
									<div class="middle">
										<a class="buy" href="#">申请售后</a>
									</div>
								</div>
                                {% endif %}
                                {% endif %}
								<div class="clear"></div>
							</div>
                            {% endfor %}
                    </li>
                    {% endfor %}
                </ul>
			</div>
		</div>
	</div>
	<div class="clear"></div>
</div>
{% endblock %}